1. Field of the Invention
The present invention relates to an image processing apparatus, an image processing method, and a computer program for comparing a multivalued image obtained by picking up an image of a determination target object with a reference multivalued image.
2. Description of the Related Art
Conventionally, a method has been developed to determine whether a determination target object is a non-defective item or not by simply comparing a multivalued image obtained by picking up an image of the determination target object with a reference multivalued image. However, in this simple comparison between the images, it is impossible to consider changes in pixel values caused by variation of a shape of the non-defective item itself, calculation errors, noises, and the like, and there is a problem in that it may be impossible to correctly determine a non-defective item. For example, even a non-defective item may be falsely determined as a defective item.
In order to solve such a problem, for example, Japanese Unexamined Patent Publication No. 2005-265661 discloses a technique in which multivalued images are prepared for a plurality of non-defective items, and mean value images and standard deviation images thereof are obtained. In this technique, a determination can be stably made as to whether an object is defective or not. More specifically, aligning is made with respect to the multivalued images for the plurality of non-defective items, and thereafter, a mean value and a standard deviation are calculated for a pixel value of a pixel at each coordinate. The multivalued image of a determination target object is aligned with the multivalued images of the non-defective items. Thereafter, a difference value with a mean value is calculated for a pixel at each coordinate, and comparison is made with a defined threshold value image for each pixel based on the standard deviation, whereby determination is made as to whether the object is a non-defective item or not.
In this method, variations of pixel values due to variation in the shape of the non-defective item itself, calculation errors, noises, and the like can be effectively eliminated in accordance with the degree of variation of a pixel value at each pixel, and since a range in which an object is determined to be a non-defective item is different in each pixel, an appropriate threshold value for determining a non-defective item can be defined for each portion. Therefore, a non-defective item can be determined with high accuracy.
However, in the image processing method disclosed in Japanese Unexamined Patent Publication No. 2005-265661, when there is a defect in proximity to a contour line, it is difficult to recognize the defect since the standard deviation of the pixel value is large. Therefore, there is a problem in that the sensitivity for detecting defect is reduced. The reason why the standard deviation of the pixel value is large in proximity to the contour line is due to a small difference in the alignment, a small difference in the imaging position, variation of individual non-defective items, and the like.
In a black and white image, it may be difficult to detect difference of colors. Moreover, there is a problem in that, when there is a large variation in the overall gray level, it is difficult to detect a portion where the brightness is partially different, e.g., a portion where a surface is recessed.